package com.oamicnet.boot.config.config;

import com.oamicnet.boot.config.entity.Student;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties("student")
@Data
public class BeanConfig {
    private Long id;
    private String name;
    private int age;

    /**
     * 可以用这种方式创建bean
     * @return
     */
    @Bean("student")
    public Student getStudent() {
        return new Student(id,name,age);
    }

}
